package enum

/**
 * 匿名类
 */
enum class ProtocolState {
    WAITING {
        override fun signal() = TALKING
    },
    TALKING {
        override fun signal() = WAITING
    };

    abstract fun signal():ProtocolState

}

fun main(args: Array<String>) {
    println(ProtocolState.WAITING.signal().name)
    println(ProtocolState.TALKING.signal().name)
    ProtocolState.values().forEach {
        println(it.name)
    }
}